package lanQiaoBei.基础算法.sort;
import java.io.*;
/*
* 整数二分 以“数的范围”题目为例展示二分模板
* 1 3 5 7 7 7 10
* */
public class P3 {
    static int N;//数组长度
    static int Q;//询问元素
    public static void main(String[] args) throws Exception{
        int[] arr = scan();
        int l=0,r=N-1;
        while(l<r){
             int mid=l+r>>1;
             if(arr[mid]>=Q)r=mid;
             else l=mid+1;
        }
        if(arr[l]!=Q){
            System.out.print("-1");
            return;
        }
        System.out.print(l+" ");
        l=0;r=N-1;
        while(l<r){
            int mid=l+r+1>>1;
            if(arr[mid]<=Q)l=mid;
            else r=mid-1;
        }
        System.out.print(l+" ");
    }
    public static int[]scan() throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        N=Integer.parseInt(br.readLine());
        Q=Integer.parseInt(br.readLine());
        int[] arr = new int[N];
        String []s=br.readLine().split(" ");
        for (int i = 0; i <N ; i++) {
            arr[i]=Integer.parseInt(s[i]);
        }
        return arr;
    }
}
